home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / queues.exe / QSERVER.C < prev    next >
Text File  |  1992-01-13  |  3KB  |  86 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2.  *                                                                           *
  3.  *                                                                           *
  4.  Program : QSERVER.C
  5.  Date    : 05/20/91
  6.  Function: QSERVER services a queue.
  7.  Genesis : Turbo C 2.0
  8.            Compiled in Turbo C environment with defaults under DOS 3.3.
  9.  
  10.  This software is provided as is and carries no warranty
  11.  whatsoever.  Novell disclaims and excludes any and all implied
  12.  warranties of merchantability, title and fitness for a particular
  13.  purpose.  Novell does not warrant that the software will satisfy
  14.  your requirements or that the software is without defect or error
  15.  or that operation of the software will be uninterrupted.  You are
  16.  using the software at your risk.  The software is not a product
  17.  of Novell, Inc. or any of subsidiaries.
  18.  *                                                                           *
  19.  *                                                                           *
  20.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  21.  
  22. #include <stdio.h>
  23. #include <nit.h>
  24. #include <niterror.h>
  25. #include <nitq.h>
  26.  
  27. #define OT_TEST_SERVER 0x8010
  28. #define OT_TEST_QUEUE  0x8020
  29. #define NO_CHARGE 0L
  30. #define IOERROR   -1
  31. char readBuf[20];
  32.  
  33. main()
  34. {
  35.     long queueID;
  36.     long charge = 0;
  37.     int  cCode, errno;
  38.     int  fileHandle;
  39.     int  readResult;
  40.     WORD conID;
  41.     WORD jobType = 0x0045;
  42.     WORD jobCount;
  43.     BYTE directoryHandle;
  44.     BYTE drive;
  45.     BYTE statFlag;
  46.     JobStruct job;
  47.     char fileServer[48], QServer[48];
  48.  
  49.     strcpy (QServer, "CHRIS_SERVER");
  50.    cCode = LoginToFileServer (QServer, OT_TEST_SERVER, "CHRISERVER");
  51.    if(cCode != 0) {
  52.       printf("\nError in LoginToFileServer.  Status = %d",cCode);
  53.       exit(1);
  54.    }
  55.    printf("\n%s successfully logged into server.", QServer);
  56.  
  57.     queueID=-1;
  58.     if (cCode = GetBinderyObjectID ("CHRIS_QUEUE",
  59.                                     OT_TEST_QUEUE,
  60.                                     &queueID)) {
  61.       printf ("\nError %d getting bindery object ID.", cCode);
  62.       exit (1);
  63.       }
  64.     if (cCode = AttachQueueServerToQueue (queueID))
  65.       printf ("\nError %d attaching queue server to queue.", cCode);
  66.     job.serverIDNumber = 0x00;
  67.     if (cCode = ServiceQueueJobAndOpenFile (queueID,
  68.                                             jobType,
  69.                                             &job,
  70.                                             &fileHandle))
  71.       printf ("\nError %d servicing queue job.", cCode);
  72.     readResult = read (fileHandle, readBuf, sizeof (readBuf));
  73.     if (readResult==IOERROR)
  74.       printf ("\nError %d occured on read.", errno);
  75.     else
  76.       printf ("\nIncoming!:%s.", readBuf);
  77.     if (cCode = FinishServicingQueueJobAndFile (queueID,
  78.                                                 job.jobNumber,
  79.                                                 NO_CHARGE,
  80.                                                 fileHandle))
  81.       printf ("\nError %d finishing servicing queue job and file.", cCode);
  82.     if (cCode = DetachQueueServerFromQueue (queueID))
  83.       printf ("\nError %d detaching queue server from queue.", cCode);
  84. }
  85.  
  86.